const path = require("path");
const plugins=require("./config/webpack_plugin.js");
const rules= require("./config/webpack_rule.js");
const PATHS={
	app:path.join(__dirname,'app'),
	build:path.join(__dirname,'build'),
};

module.exports={
	devtool:"cheap-source-map",
	entry:{
		app:PATHS.app,
		jquery:"jquery",
	},
	output:{
		path:PATHS.build,
		filename:"[name].js"
	},
	module:{
		rules:[
			rules.css,
			rules.scss,
			rules.js,
			rules.img,
		]
	},
	plugins:[
			plugins.extractCss,
			plugins.providePlugin,
			plugins.commonsChunkPlugin,
			plugins.html,
			//plugins.sourceMap,
	],
	devServer:{
		contentBase:path.resolve(__dirname,'build'),
		host:'192.168.15.249',
		compress:true,
		port:1717,
		overlay:{  //把编译的错误显示在浏览器上
			errors:true,
			warnings:true,
		},
	},
}